<!DOCTYPE html>
<html lang="en">
<head>
<title>huangliusong</title>
<script src="./vue.js"></script>
</head>
 
<body>
	<div id="app">
	{{fullName}}
	{{age}}
	</div>
	<script type="text/javascript">
	var vm=new Vue({
		el:"#app",
		data:{
			firstName:"Dell",
			lastName:"Lee",
			fullName:"Dell Lee",
			age:88
		},
		/*computed:{
			fullName:function(){
				console.log("计算了一次");
				return this.firstName+" "+this.lastName
			}
		},*/
		/*methods:{
			fullName:function(){
				console.log("计算了一次");
				return this.firstName+" "+this.lastName
			}
		},*/
		watch:{
			firstName:function(){
				console.log("计算了一次");
				this.fullName=this.firstName+" "+this.lastName
			},
			lastName:function(){
				console.log("计算了一次");
				this.fullName=this.firstName+" "+this.lastName
			}
		}
	})
	</script>
</body>

</html>